import util from '@ohos.util';

export function getMs(intervalInSeconds: number) {
  return ~(intervalInSeconds == 60 ? 0x03 : 0x01);
}

let decoder = util.TextDecoder.create();
export function bufferToString(data: ArrayBuffer | Uint8Array) {
  let input = (data instanceof ArrayBuffer) ? new Uint8Array(data) : data;
  return decoder.decodeWithStream(input);
}